<template>
  <div id="tableBox" style="margin:0 25px;" ref="ruleForm">
    <el-table :data="tableData" border>
      <el-table-column label="订单号" width="140" fixed>
        <template scope="scope">
          <span>{{ scope.row.orderNumber }}</span>
        </template>
      </el-table-column>
      <el-table-column label="回款总额(元)  " min-width="240">
        <template scope="scope">
          <span>{{ scope.row.repaymentMoney| toFixed2 }}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 回款本金(元)  " :min-width="300">
        <template scope="scope">
          <span>{{ scope.row.capital | toFixed2}}</span>
        </template>
      </el-table-column>
      <el-table-column label="  回款服务费1(元)  " width="120">
        <template scope="scope">
          <span>{{ scope.row.interest| toFixed2 }}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 回款服务费2(元) " width="120">
        <template scope="scope">
          <span>{{ scope.row.exceed | toFixed2 }}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 回款延期费(元)" width="120">
        <template scope="scope">
           <span>{{ scope.row.delayMoney | toFixed2 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="差异调整金额(元) " width="180">
        <template scope="scope">
          <span>{{ scope.row.discrepancyMoney| toFixed2}}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 回款时间   " width="180">
        <template scope="scope">
          <span>{{getDate(scope.row.repaymentDate)}}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="140" fixed="right">
        <template scope="scope">
          <el-button type="info" size="small" @click='handleSee($event)' :data-id='scope.row.id'>查看</el-button>
        </template>
      </el-table-column>
    </el-table>



    <el-table :data='sum' border style='marginTop:30px'>
      <el-table-column label=" 合计回款总额(元)">
        <template scope="scope">
          <span>{{scope.row.repaymentMoney| toFixed2}}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 合计回款本金(元)">
        <template scope="scope">
          <span>{{scope.row.capital| toFixed2}}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 合计回款服务费1(元)" >
        <template scope="scope">
          <span>{{scope.row.interest| toFixed2}}</span>
        </template>
      </el-table-column>
       <el-table-column label=" 合计回款服务费2(元)" >
        <template scope="scope">
          <span>{{scope.row.exceed| toFixed2}}</span>
        </template>
      </el-table-column>
     <el-table-column label=" 合计回款延期费(元)" >
        <template scope="scope">
          <span>{{scope.row.delayMoney| toFixed2}}</span>
        </template>
      </el-table-column>
      <el-table-column label=" 合计差异调整金额(元)">
        <template scope="scope">
          <span>{{scope.row.discrepancyMoney| toFixed2}}</span>
        </template>
      </el-table-column>
    </el-table>
    <div style="textAlign:center ; marginTop:40px">
    <!-- <el-button type="primary" @click="resetForm('ruleForm')">返回</el-button>         -->
    </div>
     <div class="block" style="text-align: center;margin-top: 35px;">
           <pagination v-on:refreshSeachData="seachData()"  :tableData="pageData" :searchForm="searchForm"></pagination>
    </div>
  </div>

</template>

<script>
 import agentHttp from '@/utils/agentHttp.js';
 import {timestampToTime} from '@/utils/index.js'
import pagination from '@/views/pagination'  //分页组件
  export default {
    data() {
      return {
          tableData:[],
          sum:[],
          pageData:[]
      }
    },
    props: {
      carorderId: {
          type:Number
      },
       dialogSendData: {
        type: Object
      },
      childCode:{
        type:String
      }
    },
    mounted() {
    
      this.initData()
    },
    methods: {
      resetForm(formName) {
        // this.$refs[formName].resetFields();
        this.dialogSendData.dialogFormVisible = false;
      },
      handleSee(e){
        const id = e.currentTarget.dataset.id
        const value = 'child查看'
        const obj = {} ;
        obj.id= id ;
        obj.value = value ;
        this.$emit('look',obj)
      },
      initData(){
        agentHttp.get(`adminApi/admin/mortgage_order_repayment/view_list/${this.carorderId}`).then(res=>{
                if(res.success){
                  this.tableData = res.data.tableData.data
                  this.sum.push(res.data.sum)
                  this.pageData =res.data.tableData ;
                }
        })
      },
      getDate(time){
        return timestampToTime(time)
      }
    },
    components:{
      pagination,
    }
  }

</script>

